Functions

bool isValid void GetName int ID int Type int X int Y int Z int Jump int Dir int Rate int Haltrate int Homing int Hunger int Step bool CollDetection int ASpeed int DrawStyle int HP int Damage int WeaponDamage int Stun int OriginalTile int Tile int Weapon int ItemSet int CSet int BossPal int SFX int Extend int TileWidth int TileHeight int HitWidth int HitHeight int HitZHeight int HitXOffset int HitYOffset int DrawXOffset int DrawYOffset int DrawZOffset int Defense[] int Attributes[] int MiscFlags float Misc[] void BreakShield
Back to Top
Pages: Global | FFC | Link | Screen | Item | Weapon | Itemdata | Game | NPC | std | string

NPC Functions and Variables Documentation

Functions and Properties

Return Type Function Information
boolisValid()
Returns whether or not this NPC pointer is still valid. A pointer
becomes invalid if the enemy dies or Link leaves the screen.
Trying to access any variable of an invalid NPC pointer prints
an error to allegro.log and does nothing.
voidGetName(int buffer[])
Loads the npc's name into 'buffer'. To load an NPC from an ID rather than a pointer
use 'GetNPCName' from std.zh
intID
The NPC's enemy ID number.
npc->ID is read-only; while setting it is not syntactically incorrect, it does nothing.
intType
The NPC's Type. Use the NPCT_ constants in std.zh to compare this value.
npc->Type is read-only; while setting it is not syntactically incorrect, it does nothing.
intX
The NPC's current X coordinate, in pixels. Float values passed to this will be cast to int.
intY
The NPC's current Y coordinate, in pixels. Float values passed to this will be cast to int.
intZ
The NPC's current Z coordinate, in pixels. Float values passed to this will be cast to int.
intJump
The NPC's upward velocity, in pixels. If negative, the NPC will fall.
The downward acceleration of Gravity (in Init Data) modifies this value every frame.
intDir
The direction the NPC is facing. Use the DIR_ constants in std.zh to
set and compare this value.
intRate
The rate at which the NPC changes direction. For a point of reference
the "Octorok (Magic)" enemy has a rate of 16. The effect of writing to
this field is currently undefined.
intHaltrate
The extent to which the NPC stands still while moving around the
screen. As a point of reference, the Zols and Gels have haltrate of
16. The effect of writing to this field is currently undefined.
intHoming
How likely the NPC is to move towards Link.
The effect of writing to this field is currently undefined.
intHunger
How likely the NPC is to move towards bait.
The effect of writing to this field is currently undefined.
intStep
The NPC's movement speed. A Step of 100 usually means that
the enemy moves at approximately one pixel per animation frame.
As a point of reference, the "Octorok (Magic)" enemy has
a step of 200. The effect of writing to this field is
currently undefined.
boolCollDetection
Whether the NPC will use the system's code to work out collisions with Link
Initialised as 'true'.
intASpeed
The the NPC's animation frame rate, in screen frames. The effect of
writing to this field is currently undefined.
intDrawStyle
The way the NPC is animated. Use the DS_ constants in std.zh to set or
compare this value. The effect of writing to this field is currently undefined.
intHP
The NPC's current hitpoints. A weapon with a Power of 1 removes 2
hitpoints.
intDamage
The amount of damage dealt to an unprotected Link when he touches this NPC, in
quarter-hearts.
intWeaponDamage
The amount of damage dealt to an unprotected Link by this NPC's weapon, in
quarter-hearts.
intStun
The time, in frames, that the NPC will be stunned. Some types of enemies cannot be stunned.
intOriginalTile
The number of the starting tile used by this NPC.
intTile
The current tile associated with this NPC. The effect of writing to this variable is undefined.
intWeapon
The weapon used by this enemy. Use the WPN_ constants (NOT the EW_ constants)
in std.zh to set or compare this value.
intItemSet
The items that the NPC might drop when killed. Use the IS_ constants
in std.zh to set or compare this value.
intCSet
The CSet used by this NPC.
intBossPal
The boss pallete used by this NPC; this pallete is only used if CSet
is 14 (the reserved boss cset). Use the BPAL_ constants in std.zh to
set or compare this value.
intSFX
The sound effects emitted by the enemy. Use the SFX_ constants in
std.zh to set or compare this value.
intExtend
Whether to extend the sprite of the enemy.
intTileWidth
The number of tile columns composing the sprite.
Writing to this is ignored unless Extend is set to values >=3.
intTileHeight
The number of tile rows composing the sprite.
Writing to this is ignored unless Extend is set to values >=3.
intHitWidth
The width of the sprite's hitbox, or collision rectangle.
intHitHeight
The height of the sprite's hitbox, or collision rectangle.
intHitZHeight
The Z-axis height of the sprite's hitbox, or collision rectangle.
The greater it is, the higher Link must jump or fly over the sprite to avoid taking damage.
intHitXOffset
The X offset of the sprite's hitbox, or collision rectangle.
Setting it to positive or negative values will move the sprite's hitbox left or right.
intHitYOffset
The Y offset of the sprite's hitbox, or collision rectangle.
Setting it to positive or negative values will move the sprite's hitbox up or down.
intDrawXOffset
The X offset of the sprite.
Setting it to positive or negative values will move the sprite's tiles left or right relative to its position.
intDrawYOffset
The Y offset of the sprite. In non-sideview screens, this is usually -2.
Setting it to positive or negative values will move the sprite's tiles up or down relative to its position.
intDrawZOffset
The Z offset of the sprite. This is ignored unless Extend is set to values >=3.
intDefense[]
The npc's Defense values, as an array of 18 integers. Use the NPCD_ and NPCDT_ constants
in std.zh to set or compare these values.
intAttributes[]
The npc's Miscellaneous Attributes, as an array of ten integers.
They are read-only; while setting them is not syntactically incorrect, it does nothing.
intMiscFlags
The npc's Misc. Flags as 14 bits ORed together, starting with 'Damaged by Power 0 Weapons'
and working down the flags in the order they are shown in the Enemy Editor.
npc->MiscFlags is read-only; while setting it is not syntactically incorrect, it does nothing.
If you are not comfortable with binary operations, you can use 'GetNPCMiscFlag' from std.zh
floatMisc[]
An array of 16 miscellaneous variables for you to use as you please.
voidBreakShield()
Breaks the enemy's shield if it has one. This works even if the flag